const fs = require('fs');
import { getTragetPath } from '../../env'

export function writeFile(compileResult){
    let mergeCode='';
    const distPath=getTragetPath();
    compileResult.forEach((compileInfo)=>{
        const {code,moduleId}=compileInfo;
        const amdCode=`modDefine("${moduleId}",function(require,module,exports){${code}});`
        mergeCode+=amdCode;
    });
    fs.writeFileSync(distPath+'/logic.js',mergeCode);
}
